package com.demo.testpackage;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.demo.entity.Body;
import com.demo.entity.Request;
import com.demo.entity.Student;

import java.util.Optional;

/**
 * @author zhiqiang
 */
public class StringTest {
    public static void main(String[] args) {
        String path = "/usr/zhiqiang/demo/name";
        // startsWith()方法用于判断是否以xxx开头，后加数字表示第几位以xxx开头,以0开始计算
        System.out.println(path.startsWith("/"));
        System.out.println(path.startsWith("z", 3));
        Page<Student> page = new Page<>();
        Request request = new Request();
        Body body = new Body();
        body.setSize(9L);
        request.setBody(body);
        Body body2 = request.getBody();
        // 如果size为空则使用3L
        page.setCurrent(Optional.ofNullable(body2.getSize()).orElse(3L));
        // 获取option空对象
        Optional<Object> empty = Optional.empty();
        System.out.println(empty);
        long current = page.getCurrent();
        System.out.println(current);
    }
}
